package com.zhu.day.util;

import com.alibaba.fastjson.JSON;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class B {

//    public static void main(String[] args) {
//
////        String json = "[\"344886164\",\"868617965\",\"569952735\",\"842797703\",\"794342153\",\"486100685\",\"76323474\",\"786249465\",\"655236195\",\"534713202\",\"780333400\",\"811916736\",\"811488319\",\"272726603\",\"168149066\",\"371237293\",\"114680684\",\"329467968\",\"793825373\",\"753324339\",\"830530703\",\"644226469\",\"328902569\",\"642645502\",\"67007230\",\"258399616\",\"625468396\",\"672739675\",\"340020211\",\"826111930\",\"462364840\",\"837588960\",\"850940611\",\"732439117\",\"817956190\",\"821909968\",\"787933775\",\"461747157\",\"547239217\",\"858366362\",\"854680946\",\"776254116\",\"158416052\",\"605114062\",\"835586249\",\"850691487\",\"815646081\",\"760067893\",\"163981090\",\"860447401\",\"812725027\",\"842885501\",\"858677996\",\"604866410\",\"265607473\",\"784843943\",\"703871458\",\"334095067\",\"864154265\",\"868932791\",\"405879862\",\"736718578\",\"855701036\",\"376358736\",\"82888029\",\"867436173\",\"561008170\",\"765965784\",\"425306029\",\"113024322\",\"764713951\",\"673308009\",\"859838823\",\"646642624\",\"367238178\",\"558593630\",\"723691613\",\"84063688\",\"858006391\",\"752335256\",\"606281012\",\"360337329\",\"860732314\",\"135177694\",\"806235846\",\"406403894\",\"831589394\",\"686368141\",\"669560854\",\"802787307\",\"854063583\",\"757653232\",\"683339113\",\"583470495\",\"789275846\",\"215073799\",\"831341057\",\"58187700\",\"378547039\",\"734752641\",\"413513968\",\"582686902\",\"855376463\",\"856864272\",\"626876574\",\"866571554\",\"860703590\",\"307443381\",\"437967478\",\"784913485\",\"856827557\",\"327554233\",\"860314637\",\"856992866\",\"791098782\",\"350210782\",\"860644106\",\"836760090\",\"830699649\",\"669185783\",\"866389868\",\"488181716\",\"484859006\",\"660529926\",\"724998052\",\"318371308\",\"591802030\",\"48674988\",\"409127943\",\"542684429\",\"339499005\",\"395800686\",\"41700036\",\"712115934\",\"563218471\",\"754340660\",\"644661616\",\"648605942\",\"348721904\",\"632248542\",\"353764268\",\"783220383\",\"642802136\",\"730253663\",\"380214032\",\"594502491\",\"376577726\",\"696687362\",\"411636217\",\"637769456\",\"401103536\",\"263829317\",\"799198541\",\"399886888\",\"645827895\",\"748105881\",\"340165971\",\"171125669\",\"495521989\",\"772098584\",\"546949760\",\"516487443\",\"152249439\",\"355784769\",\"378633829\",\"405774686\",\"436285772\",\"244043542\",\"466887666\",\"478901042\",\"428706001\",\"625907866\",\"636763197\",\"358053554\",\"527204767\",\"741055300\",\"33791912\",\"177638884\",\"184746042\",\"447625052\",\"364307094\",\"263564211\",\"739203097\",\"16242255\",\"703518577\",\"386826837\",\"640970619\",\"52992096\",\"509977403\",\"676652774\",\"497645265\",\"562480360\",\"506950816\",\"118043804\",\"333510056\",\"650154103\",\"433142247\",\"773853681\",\"435152576\",\"62777988\",\"315731276\",\"446293275\",\"65971225\",\"645009276\",\"737338078\",\"163960378\",\"265048677\",\"5136207\",\"643129441\",\"187886947\",\"734366091\",\"737530279\",\"139961798\",\"545690357\",\"358377968\",\"629370221\",\"642555519\",\"481813246\",\"570773416\",\"53188785\",\"35708078\",\"484066315\",\"710657794\",\"779098706\",\"170008470\",\"714782739\"]";
////        List<String> list = JSON.parseArray(json,String.class);
////        System.out.println(list);
//
//
//        double a = 3000;
//        double b = 4500;
//        double c = 1500/8*3*2;
//        System.out.println(a+" ---"+b+"----"+c);
//        System.out.println(a+b+c);
//    }

    public static void main(String[] args) {
        String json = "[\n" +
                "    {\n" +
                "        \"title\":\"第一篇章VCR：冒险\",\n" +
                "        \"titleImg\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577686336131-title1.png\",\n" +
                "        \"lists\":[\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528756-show1.jpg\",\n" +
                "                \"rank\":1,\n" +
                "                \"showName\":\"开场秀\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2020/01/06/1578303191386-show2.jpg\",\n" +
                "                \"rank\":2,\n" +
                "                \"showName\":\"《High唱MOMO》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"35022874\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"639104369\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"753966897\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"1450050\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528123-show3.jpg\",\n" +
                "                \"rank\":3,\n" +
                "                \"showName\":\"《野狼disco》\",\n" +
                "                \"guestName\":\"宝石\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"106757414\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528357-show4.jpg\",\n" +
                "                \"rank\":4,\n" +
                "                \"showName\":\"《爱你》\",\n" +
                "                \"guestName\":\"王心凌\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"201782609\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528411-show5.jpg\",\n" +
                "                \"rank\":5,\n" +
                "                \"showName\":\"《第一次爱的人》\",\n" +
                "                \"guestName\":\"王心凌\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"458107897\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ]\n" +
                "    },\n" +
                "    {\n" +
                "        \"name\":\"第二篇章VCR：坚持\",\n" +
                "        \"titleImg\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577698477366-title2.png\",\n" +
                "        \"lists\":[\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/31/1577772725165-show6.jpg\",\n" +
                "                \"rank\":6,\n" +
                "                \"showName\":\"《国风美少女》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"701075627\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"371378010\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2020/01/06/1578303191304-show7.jpg\",\n" +
                "                \"rank\":7,\n" +
                "                \"showName\":\"《金曲串烧》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"564245320\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"413505392\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"461232614\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2020/01/06/1578309307223-show8.jpg\",\n" +
                "                \"rank\":8,\n" +
                "                \"showName\":\"《给我一个理由忘记》\",\n" +
                "                \"guestName\":\"Alin\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"349904252\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ]\n" +
                "    },\n" +
                "    {\n" +
                "        \"name\":\"第三篇章VCR：幸运\",\n" +
                "        \"titleImg\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577698477299-title3.png\",\n" +
                "        \"lists\":[\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2020/01/06/1578303191385-show9.jpg\",\n" +
                "                \"rank\":9,\n" +
                "                \"showName\":\"《约定》\",\n" +
                "                \"guestName\":\"光良\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"461232614\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528859-show10.jpg\",\n" +
                "                \"rank\":10,\n" +
                "                \"showName\":\"《童话》\",\n" +
                "                \"guestName\":\"光良\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"351644637\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693528922-show11.jpg\",\n" +
                "                \"rank\":11,\n" +
                "                \"showName\":\"《我的梦》\",\n" +
                "                \"guestName\":\"梁咏琪\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"2934982\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ]\n" +
                "    },\n" +
                "    {\n" +
                "        \"name\":\"第四篇章VCR：燃烧\",\n" +
                "        \"titleImg\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577698477332-title4.png\",\n" +
                "        \"lists\":[\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/31/1577772724320-show12.jpg\",\n" +
                "                \"rank\":12,\n" +
                "                \"showName\":\"《谁》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"125364391\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/31/1577772724166-show13.jpg\",\n" +
                "                \"rank\":13,\n" +
                "                \"showName\":\"《答应自己》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"415134950\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2020/01/02/1577961359088-show14.jpg\",\n" +
                "                \"rank\":14,\n" +
                "                \"showName\":\"《燃烧吧少女》\",\n" +
                "                \"guestName\":\"腾格尔\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"542684429\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"329960927\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"577391452\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"495521989\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"439987661\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"265048677\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"383422165\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"577734415\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"661119082\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"220908702\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"457566233\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"momoid\":\"401354940\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/31/1577773231467-show15.jpg\",\n" +
                "                \"rank\":15,\n" +
                "                \"showName\":\"《我的梦》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"440197225\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693529369-show16.jpg\",\n" +
                "                \"rank\":16,\n" +
                "                \"showName\":\"《刚刚好》\",\n" +
                "                \"guestName\":\"薛之谦\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"86977431\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ]\n" +
                "    },\n" +
                "    {\n" +
                "        \"name\":\"第五篇章VCR：荣耀\",\n" +
                "        \"titleImg\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577698477366-title5.png\",\n" +
                "        \"lists\":[\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693529306-show17.jpg\",\n" +
                "                \"rank\":17,\n" +
                "                \"showName\":\"《为你我受冷风吹》\",\n" +
                "                \"guestName\":\"林忆莲\",\n" +
                "                \"starLists\":[\n" +
                "                    {\n" +
                "                        \"momoid\":\"334370152\",\n" +
                "                        \"name\":\"\",\n" +
                "                        \"photo\":\"\"\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"cover\":\"https://s.momocdn.com/w/u/others/2019/12/30/1577693529369-show18.jpg\",\n" +
                "                \"rank\":18,\n" +
                "                \"showName\":\"《荣耀之王颁奖》\",\n" +
                "                \"guestName\":\"\",\n" +
                "                \"starLists\":[]\n" +
                "            }\n" +
                "        ]\n" +
                "    }\n" +
                "]";

        List<Map> list = JSON.parseArray(json, Map.class);



//        System.out.println(JSON.toJSONString(list));
//        checkIfFollow("419737158",list);
        System.out.println("####################################################");
        System.out.println("####################################################");
        System.out.println("####################################################");
//        System.out.println(JSON.toJSONString(list));


        System.out.println(5500+5200+2400+3400+820);
    }


    private static void checkIfFollow(String momoid,List<Map> result){
        for (Map map:result){
            Object lists = map.get("lists");
            if (null!=lists){
                List<Map> listMapsNew = new ArrayList<>();
                List<Map> listMaps = JSON.parseArray(lists.toString(), Map.class);
                for (Map mapEnter: listMaps){
                    Object starLists = mapEnter.getOrDefault("starLists",null);
                    if (Objects.nonNull(starLists)){
                        List<Map> newList = new ArrayList<>();
                        List<Map> starList = JSON.parseArray(starLists.toString(), Map.class);
                        for (Map mapStar:starList){
                            Object starid = mapStar.get("momoid");
                            if (Objects.nonNull(starid)){
                                mapStar.put("ifFollow",true);
                                newList.add(mapStar);
                            }
                        }
                        mapEnter.put("starLists",newList);
                    }
                    listMapsNew.add(mapEnter);
                }
                if (!CollectionUtils.isEmpty(listMapsNew)){
                    map.put("lists",listMapsNew);
                }
            }
        }

    }

}
